home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb.new / gdb-4.0 / bfd / doc / cache.ip < prev    next >
Encoding:
Text File  |  1991-09-29  |  1.7 KB  |  67 lines

  1. /* BFD_CACHE_MAX_OPEN
  2. The maxiumum number of files which the cache will keep open at one
  3. time.
  4. */
  5. #define BFD_CACHE_MAX_OPEN 10
  6.  
  7. /*
  8.  
  9.   bfd_last_cache
  10. Zero, or a pointer to the topmost BFD on the chain.  This is used by
  11. the @code{bfd_cache_lookup} macro in @file{libbfd.h} to determine when
  12. it can avoid a function call.
  13. */
  14. extern bfd *bfd_last_cache;
  15.  
  16. /*
  17.  
  18.   bfd_cache_lookup
  19. Checks to see if the required BFD is the same as the last one looked
  20. up. If so then it can use the iostream in the BFD with impunity, since
  21. it can't have changed since the last lookup, otherwise it has to
  22. perform the complicated lookup function
  23. */
  24. #define bfd_cache_lookup(x) \
  25.      ((x)==bfd_last_cache? \
  26.         (FILE*)(bfd_last_cache->iostream): \
  27.          bfd_cache_lookup_worker(x))
  28.  
  29. /*
  30.  
  31. *i bfd_cache_init
  32. Initialize a BFD by putting it on the cache LRU.
  33. */
  34.  PROTO(void, bfd_cache_init, (bfd *));
  35.  
  36. /*
  37.  
  38. *i bfd_cache_close
  39. Remove the BFD from the cache. If the attached file is open, then close it too.
  40. */
  41.  PROTO(void, bfd_cache_close, (bfd *));
  42.  
  43. /*
  44.  
  45. *i bfd_open_file
  46. Call the OS to open a file for this BFD.  Returns the FILE *
  47. (possibly null) that results from this operation.  Sets up the
  48. BFD so that future accesses know the file is open. If the FILE *
  49. returned is null, then there is won't have been put in the cache, so
  50. it won't have to be removed from it.
  51. */
  52.  PROTO(FILE *, bfd_open_file, (bfd *));
  53.  
  54. /*
  55.  
  56. *i bfd_cache_lookup_worker
  57. Called when the macro @code{bfd_cache_lookup} fails to find a quick
  58. answer. Finds a file descriptor for this BFD.  If necessary, it open it.
  59. If there are already more than BFD_CACHE_MAX_OPEN files open, it trys to close
  60. one first, to avoid running out of file descriptors. 
  61. */
  62.  PROTO(FILE *, bfd_cache_lookup_worker, (bfd *));
  63.  
  64. /*
  65. */
  66.  
  67.